%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Plot success-rate for as a function of temperature
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all

load Shekel\HMC_Solution.out -ascii
A = HMC_Solution;

% set these variables

numPerTemp = 30;
numDifferentTemp = 10;
WhenChiSquaredSolution = -6;
startTemp = 0.005;
tempStep = 0.001;


success = zeros([numDifferentTemp 1]);
temp_plot = zeros([numDifferentTemp 1]);

for itemp = 1 : numDifferentTemp
    for i = 1 : numPerTemp 
        if A(i+numPerTemp*(itemp-1),2) < WhenChiSquaredSolution
            success(itemp) =  success(itemp) + 1;
        end
    end
   % if itemp == 1
        temp_plot(itemp) = startTemp + (itemp-1)*tempStep;
   % else
    %    temp_plot(itemp) = temp_plot(itemp-1) + tempStep;
   % end
end

hold off

%subplot(2,1,1)
plot(temp_plot, success)
xlabel('T')
ylabel('nnmber successes')
